package jjn.acwing.weekly;

import java.util.Scanner;

/**
 * @author Jjn
 * @since 2023/8/19 19:07
 */
public class Acwing5138 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.nextLine();
        String line = scanner.nextLine();
        int[] count = new int[26];
        int totalDamage = 0;
        for (int i = 0; i < 2 * (n - 1); i++) {
            char c = line.charAt(i);
            if (i % 2 == 0) {
                count[c - 'a']++;
            } else {
                int index = c - 'A';
                if (count[index] > 0) {
                    count[index]--;
                } else {
                    totalDamage++;
                }
            }
        }
        System.out.println(totalDamage);
    }
}
